import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/index',
      name: 'index',
      component: () => import('../views/Index.vue'),
      children:[
        {
          path: '/index/home',
          name: 'home',
          component: () => import('../views/Index/Home.vue'),
          children:[
            // hwj负责模块
          
            //3、 首页
            {
              path: '/index/home/hwj/homepage',
              name: 'homepage',
              component: () => import('../views/Index/Home/hwj/homepage.vue'),
            },
            // 4、商机管理
              //  4.1 创建商机
            {
              path: '/index/home/hwj/business',
              name: 'business',
              component: () => import('../views/Index/Home/hwj/business.vue'),
            },
            // 4.2编辑商机businessDetails
            {
              path: '/index/home/hwj/businessedit',
              name: 'businessedit',
              component: () => import('../views/Index/Home/hwj/businessEdit.vue'),
            },
            // 4.3商机详情 
            {
              path: '/index/home/hwj/businessdetails',
              name: 'businessdetails',
              component: () => import('../views/Index/Home/hwj/businessDetails.vue'),
            },
            // 4.3搜索商机 
            {
              path: '/index/home/hwj/searchbusiness',
              name: 'searchbusiness',
              component: () => import('../views/Index/Home/hwj/searchBusiness.vue'),
            },
            // lsl负责模块
            //5、产品管理
            {
              path: '/index/home/lsl/product',
              name: 'product',
              component: () => import('../views/Index/Home/lsl/product.vue'),
            },
            // 6、合同管理
            {
              path: '/index/home/lsl/contract',
              name: 'contract',
              component: () => import('../views/Index/Home/lsl/contract.vue'),
            },
            // lzn负责模块
            // 7、信息管理
            {
              path: '/index/home/lzn/informations',
              name: 'informations',
              component: () => import('../views/Index/Home/lzn/informations.vue'),
            },
            // xhz负责模块

            // 8、用户管理
            {
              path: '/index/home/xhz/users',
              name: 'users',
              component: () => import('../views/Index/Home/xhz/users.vue'),
            },
          
          //  zqq负责模块
            // 9、日志管理
            {
              path: '/index/home/zqq/logs',
              name: 'logs',
              component: () => import('../views/Index/Home/zqq/logs.vue'),
            },
   
            //10、员工管理
            {
              path: '/index/home/zqq/employees',
              name: 'employees',
              component: () => import('../views/Index/Home/zqq/employees.vue'),
            },

            // 路由重定向
            {
              path: '/',
              redirect: '/index/home'
            },
            // 找不到地址跳错误提示页面
            {
              path: '*',
              component: () => import('../views/NotFound.vue')
            },
       
        
          ]
        },
        {
          path: '/index/contact',
          name: 'contact',
          component: () => import('../views/Index/Contact.vue'),
        },
        {
          path: '/index/order',
          name: 'order',
          component: () => import('../views/Index/Order.vue'),
        },

        // 1、注册
        {
          path: '/register',
          name: 'register',
          component: () => import('../views/Register.vue'),
        },
        // 2、登录
        {
          path: '/login',
          name: 'login',
          component: () => import('../views/Login.vue'),
        },
        // 路由重定向
        {
          path: '/',
          redirect: '/index/home'
        },
        // 找不到地址跳错误提示页面
        {
          path: '*',
          component: () => import('../views/NotFound.vue')
        },
      ]
      
    }
   
  ]
})

export default router
